<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: ACER
  Date: 2017/6/6
  Time: 19:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<body style="background: rgba(180, 248, 128, 0.77)">
<jsp:include page="/index.jsp"></jsp:include>


<script language="javascript">
    function delcfm() {
        if (!confirm("确认要删除？")) {
            window.event.returnValue = false;
        }
    }
</script>
<table align="center" style="font-size: 25px" border="1px" width="70%">
    <tr>
        <th> 学号</th>
        <th> 密码</th>
        <th> 姓名</th>
        <th> 性别</th>
        <th> 系别</th>
        <th>操作</th>
    </tr>

    <c:forEach items="${studentList}" var="student">
        <tr align="center">
            <td>${student.studentNo}</td>
            <td>${student.studentPassword}</td>
            <td>${student.studentName}</td>
            <td>${student.studentSex}</td>
            <td>${student.studentDept}</td>
            <td><a onClick="delcfm()" href="${pageContext.request.contextPath}/students/delete?id=${student.studentId}">删除</a>
                &nbsp;<a href="${pageContext.request.contextPath}/students/update?id=${student.studentId}&&sno=${student.studentNo}&&password=${student.studentPassword}&&name=${student.studentName}&&sex=${student.studentSex}&&dept=${student.studentDept}">更新</a>&nbsp;<a href="${pageContext.request.contextPath}/sc/scList?id=${student.studentId}">查看成绩</a></td>
        </tr>


    </c:forEach>
    <tr align="center">
        <td colspan="5" align="center">
            <pg:pager  url="${pageContext.request.contextPath}/students/studentList" items="${pager.totalRecord}" maxIndexPages="10" maxPageItems="${pager.pageSize}" export="currentPageNumber=pageNumber"><!-- export对pageNumber的重命名 -->
            <pg:first>
                <a href="${pageUrl }">首页</a>
            </pg:first>
            <pg:prev>
                <a href="${pageUrl }">前页</a>
            </pg:prev>
            <pg:pages>
                <c:choose>
                    <c:when test="${currentPageNumber eq pageNumber }">
                        <font color="red">${pageNumber }</font>
                    </c:when>
                    <c:otherwise>
                        <a href="${pageUrl }">${pageNumber }</a>
                    </c:otherwise>
                </c:choose>
            </pg:pages>
            <pg:next>
                <a href="${pageUrl }">后页</a>
            </pg:next>
            <pg:last>
                <a href="${pageUrl }">尾页</a>
            </pg:last>
            <br/>
            当前第${pager.pageIndex}页,共${pager.totalPage}页
            </pg:pager>
        </td>
        <td><a href="${pageContext.request.contextPath}/students/add">添加学生</a>
        </td>
    </tr>
    <tr align="center">
        <td colspan="5" align="center">
            <form action="${pageContext.request.contextPath}/students/search">
                <input placeholder="请输入学号或姓名" type="text" name="keyword"/>
                <input  type="submit" value="查询"/>
            </form>
        </td>
    </tr>
</table>
<%--<pg:pager items="200" maxPageItems="15" maxIndexPages="10">--%>


<%--<pg:first><a href="${pageUrl}">首页</a></pg:first>--%>
<%--<pg:prev><a href="${pageUrl}">上一页</a></pg:prev>--%>
<%--<pg:next><a href="${pageUrl}">下一页</a></pg:next>--%>
<%--<pg:last><a href="${pageUrl}"> 末页</a></pg:last>--%>
<%--</pg:pager>--%>
<%--<jsp:include page="pager.jsp">--%>
<%--<jsp:param name="url" value="/students/studentList"/>--%>
<%--&lt;%&ndash;<jsp:param name="items" value="${pager.totalRecord}"/>&ndash;%&gt;--%>
<%--&lt;%&ndash;<jsp:param name="totalPage" value="${pager.totalPage}"/>&ndash;%&gt;--%>
<%--&lt;%&ndash;<jsp:param name="maxPageItems" value="${pager.pageSize}"/>&ndash;%&gt;--%>
<%--</jsp:include>--%>


<br/>

</body>
</html>
